home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Codigo / Texto y fuentes / AntiAliasedText / AntiAliasedText.cs next >
Encoding:
Text File  |  2002-05-02  |  974 b   |  33 lines

  1. //----------------------------------------------
  2. // AntiAliasedText.cs ⌐ 2001 by Charles Petzold
  3. //----------------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Drawing.Text;
  7. using System.Windows.Forms;
  8.  
  9. class AntiAliasedText: PrintableForm
  10. {
  11.      public new static void Main()
  12.      {
  13.           Application.Run(new AntiAliasedText());
  14.      }
  15.      public AntiAliasedText()
  16.      {
  17.           Text = "Texto Anti-Aliased" ;
  18.           Font = new Font("Times New Roman", 12);
  19.      }
  20.      protected override void DoPage(Graphics grfx, Color clr, int cx, int cy)
  21.      {
  22.           Brush  brush  = new SolidBrush(clr);
  23.           string str    = "A ";
  24.           int    cxText = (int) grfx.MeasureString(str, Font).Width;
  25.  
  26.           for (int i = 0; i < 6; i++)
  27.           {
  28.                grfx.TextRenderingHint = (TextRenderingHint)i;
  29.                grfx.DrawString(str, Font, brush, i * cxText, 0);
  30.           }
  31.      }
  32. }
  33.